<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2021/7/18
 * Time: 13:44
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

declare(strict_types=1);

namespace app\common\business;

use app\common\model\mysql\Specs as ModelObj;
use app\common\validate\Specs as ValidateObj;
use think\Exception;
use think\facade\Log;


class Specs extends BusBase
{
    protected ?ModelObj $modelObj = null;
    protected ?ValidateObj $validateObj = null;
    //是否验证允许重复
    protected bool $repeat = true;
    //验证数据库重复字段
    protected string $repeat_string = 'title';
    public function __construct()
    {
        $this->modelObj = new ModelObj();
        $this->validateObj = new ValidateObj();
    }

    /**
     * @return array
     * @throws Exception
     */
    public function getSpecsName()
    {
        try {
            $result = $this->modelObj->getSpecsName('id,title as name');
        } catch (\Exception $e) {
            Log::error($e->getMessage() . " " . $e->getFile() . " " . $e->getLine());
            throw new Exception("查询失败");
        }
        return $result;
    }

}